Skip to content

Fix Copy+Paste, Drag&Drop and Improve all Widgets - #92

Open
tferr wants to merge 9 commits into
scijava:mainfrom
tferr:file-widget-fix
Open

tferr wants to merge 9 commits into
scijava:mainfrom
tferr:file-widget-fix

Conversation

@tferr

@tferr tferr commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This started as a single fix for Drag and drop not working on macOS but snowballed into tackling a bunch of annoyances with the Swing widgets. Here is the list assembled w/ Claude from the commits:

All widgets

  • Fix alignment issues where e.g., the FileListWidget would not align with other widgets above and below in a dialog
  • Labels: Fix inconsistency in ellipsis and Title Case

Text (SwingTextWidget)

  • Clear button on all fields
  • The password style gets a reveal button and caps lock indicator

File (SwingFileWidget)

  • Fixed: Copy and paste of file paths was broken on Linux, macOS, and Windows
  • Fixed: Drag and drop of files from the OS was broken on macOS
  • Fixed: Choosers now open relative to the widget (before they were always appearing the upper left corner of the screen)
  • Add a placeholder text to empty path fields of with the 3 ways to populate it
  • Animate fields with FlatLaf's outline error border when an invalid file is dropped (These use FlatLaf's client properties, so they are safe if some other L&F is being used)

File list (SwingFileListWidget)

  • Duplicates: files already in the list are skipped

  • Folder scan: Runs in a background worker with a wait cursor and a disabled button, and results are added in one model swap. Files.walk is now closed, and UncheckedIOException is caught. Before the whole scan was running off the EDT!

  • Layout:

  • Ensure spacing consistency between the button panel and list. and Ensure the list pane fills the row height.

  • Apply Title case to all labels with ellipsis as needed

  • Apply tooltips

  • Buttons: Remove is disabled until something is selected, and Clear is disabled while the list is empty

  • Keyboard: Delete and Backspace remove the selected entries

Color (SwingColorWidget)

  • One chooser is reused across dialogs, so recent swatches persist
  • The dialog is now disposed after it closes, which fixes a per-click leak.

Date (SwingDateWidget, pom.xml)

  • Ported to JDatePicker 2.0.1 (org.jdatepicker)
  • Fixed DatePicker not adapting dark L&F

Console (TextFilterField, LoggingPanel)

  • The filter uses FlatLaf’s placeholder and clear button instead of the ad-hoc overlay label
  • The filter matching is case-insensitive and splits on any whitespace.
  • UX Adjustments of the log panel

Tests

  • Added SwingWidgetLayoutDemo, which shows every supported widget in one dialog.
    SwingTextWidgetDemo is back to its original contents.

The SwingFileWidget additions were manually tested on macOS 27, Ubuntu 26.04, and Windows 11. This is how things look like:

ScreenShot 2026-10-21 at 21 34 30 

tferr added 9 commits October 21, 2026 12:29
- Copy and paste of file paths was broken on  Linux, macOS, and Windows
- Drag and drop of files from the OS was broken on macOS

This fixes both using a similar approach to what is used in SNT, and adds extra improvements
- Add a clear button to all text fields
- Add a placeholder text to empty fields of SwingFileWidget with the 3 ways to populate it
- Animate fields with FlatLaf's outline error border when an invalid file is dropped
(These use FlatLaf's client properties, so they are safe if some other L&F is being used)

Tested on macOS 27, Ubuntu 26.04, and Windows 11
- Make copy and drag-out work again as per a4927e
- Duplicates: files already in the list are skipped
- Folder scan: Runs in a background worker with a wait cursor and a disabled button, and results are added in one model swap. Files.walk is now closed, and UncheckedIOException is caught. Before the whole scan was running off the EDT!

- Layout:
 - Ensure spacing consistency between the button panel and list. and Ensure the list pane fills the row height.
 - Apply Title case to all labels with ellipsis as needed
 - Apply tooltips
 - Buttons: Remove is disabled until something is selected, and Clear is disabled while the list is empty
 - Keyboard: Delete and Backspace remove the selected entries

Code cleanup: remove unused services
... and transfer home-baked customizations to  FlatLaf
Streamline toolbar, ensure consistent backgrounds, and sharpen UC
JDatePicker 2.0.2 is compiled for java 17 and won't work for Java 8
@tferr tferr changed the title Fix Copy+Paste and Drag&Drop in SwingFileWidget: Fix Copy+Paste, Drag&Drop and Improve all Widgets Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant